package practice2;

public class SharedCounter {
	
	public static int counter = 0;
	
	

	public static void main(String[] args) {
		for(int i = 0; i < 10; i++) {
			Thread t = new add();
			t.start();
			try {
				t.join();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		
		System.out.println(counter);
		

	}

}

class add extends Thread {
	public void run() {
		for(int i = 0; i < 10; i++) {
			SharedCounter.counter ++;
			//System.out.println(SharedCounter.counter);
		}
	}
}